package com.swg.wxorder.utils;

import com.swg.wxorder.enums.CodeEnum;

/**
 * @Author 【swg】.
 * @Date 2018/6/24 16:26
 * @DESC
 * @CONTACT 317758022@qq.com
 */
public class EnumUtil {
    public static <T extends CodeEnum> T getByCode(Integer code, Class<T> enumClass){
        for(T each:enumClass.getEnumConstants()){
            if(code.equals(each.getCode())){
                return each;
            }
        }
        return null;
    }
}
